//
//  AlertView.m
//  DongFeng_Online-Banking-APP
//
//  Created by wxt on 2021/4/28.
//

#import "AlertView.h"
static AlertView *alertView = nil;
@implementation AlertView
+( instancetype)alterViewWithtitle:(NSString * )titleStr andContstr:(NSString*)contentSre andBtnTitle:(NSString *)btnTitle withFrame:(CGRect)fram{
    
    if (alertView == nil) {
        alertView = [[AlertView alloc]initWithFrame:fram];
        alertView.backgroundColor = Wcolor;
        alertView.layer.masksToBounds = YES;
        alertView.layer.cornerRadius = 10;
    }
    UIView * bgvview = [[UIView alloc]initWithFrame:fram];
    bgvview.backgroundColor = Wcolor;
    [alertView addSubview:bgvview];
    TKLlable * titLab = [TKLlable labelWithFrame:CGRectMake(10, 20, fram.size.width-20, 20) text:titleStr textColor:Bcolor font:Font_6(14) textAlignment:Textcenter backgroundColor:Ccolor];
    [alertView addSubview:titLab];
    TKLlable * contentLab = [TKLlable labelWithFrame:CGRectMake(10, CGRectGetMaxY(titLab.frame)+20, fram.size.width-20, 20) text:contentSre textColor:JhColor(51, 51, 51) font:Font_6(14) textAlignment:Textcenter backgroundColor:Ccolor];
    [alertView addSubview:contentLab];
    
    UIButton * okBtn = [UIButton createBtnFrame:CGRectMake(20, CGRectGetMaxY(contentLab.frame)+20, fram.size.width-40, 25) title:btnTitle bgImageName:@"" action:^(UIButton *button) {
        if ([alertView.delegate respondsToSelector:@selector(ViewCancelBtn)]) {
            [alertView.delegate ViewCancelBtn];
        }
    }];
    [alertView addSubview:okBtn];
    
    [okBtn setTitleColor:JhColor(51, 51, 51) forState:UIControlStateNormal];
    return alertView;
    
}
/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
